/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * <p>Project: javase - Stream5
 * <p>Powered by webrx On 2021-12-22 17:54:11
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream11 {
    public static void main(String[] args) {
        var n1 = IntStream.rangeClosed(1, 100);
        //System.out.println(n1.sum());

        //System.out.println(n1.reduce(Integer::sum).getAsInt());

        var n2 = Stream.iterate(1, a -> a + 1).limit(100);
        System.out.println(n2.reduce((a, b) -> a + b).get());


    }
}
